package com.gao.controller;

import com.gao.feign.FeignDept;
import com.gao.pojo.Dept;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Resource
    private FeignDept feignDept;


    @GetMapping("/dept/get/{id}")
    public Dept getDept(@PathVariable("id") Integer id) {
        return feignDept.getDeptById(id);
    }

    @GetMapping("/dept/get/list")
    public List<Dept> getDeptList() {
        return feignDept.getDeptAll();
    }


    @PostMapping("/dept/add")
    public boolean addDept(@RequestBody Dept dept) {
        return feignDept.addDept(dept);
    }


}
